<template>
  <div class="login">
    <!-- 登录 -->
    <div v-if="getPassword" class="login-container">
      <div class="loginBox">
        <div class="topText">
          宠多多后台登录
        </div>
        <el-tabs v-model="tabs.activeName">
          <el-tab-pane label="账户密码登录" name="account">
            <AccountLogin
              @forgetPassword="getPassword = false"
            />
          </el-tab-pane>
          <el-tab-pane label="手机号码登录" name="phone">
            <PhoneLogin />
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>

    <!-- 找回密码 -->
    <RebackPassword
      v-else
      @backToLogin="() => getPassword = true"
    />
    <!--  底部  -->
    <div class="login-footer">© 2019 cereshop</div>
  </div>
</template>

<script setup>
import { defineComponent, reactive, ref } from 'vue';
import AccountLogin from './account.vue';
import PhoneLogin from './phone.vue';
import RebackPassword from './rebackPassword.vue';

defineComponent({
  name: 'LoginIndex'
})

const getPassword = ref(true);

let tabs = reactive({
  activeName: 'account'
})
</script>

<style lang="scss" scoped>
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.topText {
  font-size: 28px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  margin-bottom: 20px;
  white-space: nowrap;
}
.login {
  height: 100%;
  background-size: cover;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: url('../../assets/images/background.jpg');
}
.loginBox {
  width: 320px !important;
  height: auto;
  background: rgba(255, 255, 255, 0.3);
  padding: 25px 20px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  .el-tabs{
    :deep(.el-tabs__nav-wrap::after) {
      background-color: transparent;
    }
    :deep(.el-tabs__nav-scroll){
      display: flex;
      justify-content: center;
      .el-tabs__item{
        height: 50px;
        line-height: 50px;
      }
    }
  }
}



.login-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  text-align: center;
}
</style>
